package com.atguigu.lease.web.admin.converter;

import com.atguigu.lease.model.enums.BaseEnum;
import com.atguigu.lease.model.enums.ItemType;
import io.swagger.v3.oas.models.security.SecurityScheme;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

//@Component
public class StringToItemTypeConverter implements Converter<String , ItemType> {
    @Override
    public ItemType convert(String source) {
        ItemType[] values = ItemType.values();
        for (ItemType value : values) {
            if (value.getCode().equals(Integer.valueOf(source)))
                return value;
        }
        return null;
    }
}
